<!DOCTYPE html>
<html>
<head>
    <title>提醒统计</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="木兰湾管理系统">
    <script type="text/javascript" src="../../static/include/header-css.js"></script>
    <!--swiper组件-->
    <link rel="stylesheet" href="../../static/css/swiper.min.css">
    <!-- Demo styles -->
    <style>
        html, body {
            position: relative;
            height: 100%;
        }
        body {
            background: #eee;
            font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
            font-size: 14px;
            color:#000;
            margin: 0;
            padding: 0;
        }
        .swiper-container {
            width: 100%;
            height: 100%;
        }
        .swiper-slide {
            text-align: center;
            font-size: 18px;
            background: #fff;

            /* Center slide text vertically */
            display: -webkit-box;
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
            -webkit-box-pack: center;
            -ms-flex-pack: center;
            -webkit-justify-content: center;
            justify-content: center;
            -webkit-box-align: center;
            -ms-flex-align: center;
            -webkit-align-items: center;
            align-items: center;
        }
        .swiper-title{
            font-size: 17px;
            font-weight: bold;
            text-align: center;
            color: #000000;
        }
    </style>
</head>
<body>
<!-- Swiper -->
<div class="swiper-container">
    <div class="swiper-wrapper" id="notifyStatList">

    </div>
    <!-- Add Pagination -->
    <div class="swiper-pagination"></div>


</div>
<script type="text/javascript" src="../../static/include/footer-js.js"></script>
<!--swiper组件-->
<script type="text/javascript" src="../../static/js/swiper.min.js"></script>

<script>
    $(function() {
        loadNotifyStat();
    });
    function loadNotifyStat() {
        var html='';
        var url='/notifyStat/getData?showInIndex=true&status=ENABLE&page=-1';
        doAjax(null,url,'GET',false,function(data){
            for(var i=0; i<data.rows.length; i++) {
                var pdata = data.rows[i];
                var img = '';
                var color = "black";
                if (pdata.overAlertValue > 0) {
                    img = '<i class="weui-icon-warn"></i>';
                    color = "red";
                } else if (pdata.overWarningValue > 0) {
                    img = '<i class="weui-icon-safe-warn"></i>';
                    color = "BlueViolet";
                } else {
                    img = '<i class="weui-icon-safe-success"></i>';
                    color = "#2E8B57";
                }
                var content = '<font size="4" color="' + color + '">' + pdata.compareValue + '</font>&nbsp;&nbsp;' + pdata.userNotify.notifyConfig.valueTypeName;
                if (pdata.userNotify.notifyConfig.resultType == 'NAME_DATE' || pdata.userNotify.notifyConfig.resultType == 'NAME_NUMBER') {
                    content = '<font size="4" color="' + color + '">' + pdata.name + '</font>&nbsp;&nbsp;' + pdata.compareValue + '&nbsp;&nbsp;' + pdata.userNotify.notifyConfig.valueTypeName;
                }
                var enhContent = '<a href="#" onclick="addTab(\'' + pdata.userNotify.notifyConfig.tabName + '\',\'..' + pdata.userNotify.notifyConfig.url + '\')">' + content + '</a>';
                html+='        <div class="swiper-slide" style="background:#FCFCFC; color:#FCFCFC">\n';
                html+='            <div class="weui-pay">\n';
                html+='                <h1 class="swiper-title" align="center">\n';
                html+=img+pdata.userNotify.title;
                html+='                </h1>\n';
                html+='                <p >'+enhContent+'</p>\n';
                var unit = pdata.userNotify.notifyConfig.valueTypeName;
                html+='                <div class="weui-cells__tips">警告值：'+pdata.userNotify.warningValue+unit+'</div>\n';
                html+='                <div class="weui-cells__tips">报警值：'+pdata.userNotify.alertValue+unit+'</div>\n';
                html+='            </div>\n';
                html+='        </div>\n';
            }
            setElementInnerHTML("notifyStatList", html);
            var swiper = new Swiper('.swiper-container', {
                slidesPerView: 3,
                spaceBetween: 15,
                loop : true,
                direction: 'vertical',
                pagination: {
                    el: '.swiper-pagination',
                    clickable: true,
                }
            });
        });
    }
    function addTab(tabName,url) {
        alert(url);
    }

</script>
</body>
</html>